<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QScriptContextInfo Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QScriptContextInfo Class Reference<br /><sup><sup>[<a href="qtscript.html">QtScript</a> module]</sup></sup></h1><p>The QScriptContextInfo class provides additional information
about a <a href="qscriptcontext.html">QScriptContext</a>. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qscriptcontextinfo.html#FunctionType-enum">FunctionType</a></b> { ScriptFunction, QtFunction, QtPropertyFunction, NativeFunction }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qscriptcontextinfo.html#QScriptContextInfo">__init__</a></b> (<i>self</i>, QScriptContext&#160;<i>context</i>)</li><li><div class="fn" /><b><a href="qscriptcontextinfo.html#QScriptContextInfo-2">__init__</a></b> (<i>self</i>, QScriptContextInfo&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qscriptcontextinfo.html#QScriptContextInfo-3">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qscriptcontextinfo.html#columnNumber">columnNumber</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qscriptcontextinfo.html#fileName">fileName</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qscriptcontextinfo.html#functionEndLineNumber">functionEndLineNumber</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qscriptcontextinfo.html#functionMetaIndex">functionMetaIndex</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qscriptcontextinfo.html#functionName">functionName</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qscriptcontextinfo.html#functionParameterNames">functionParameterNames</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qscriptcontextinfo.html#functionStartLineNumber">functionStartLineNumber</a></b> (<i>self</i>)</li><li><div class="fn" />FunctionType <b><a href="qscriptcontextinfo.html#functionType">functionType</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qscriptcontextinfo.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qscriptcontextinfo.html#lineNumber">lineNumber</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qscriptcontextinfo.html#scriptId">scriptId</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qscriptcontextinfo.html#__eq__">__eq__</a></b> (<i>self</i>, QScriptContextInfo&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qscriptcontextinfo.html#__ne__">__ne__</a></b> (<i>self</i>, QScriptContextInfo&#160;<i>other</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QScriptContextInfo class provides additional information
about a <a href="qscriptcontext.html">QScriptContext</a>.</p>
<p>QScriptContextInfo is typically used for debugging purposes. It
can provide information about the code being executed, such as the
type of the called function, and the original source code location
of the current statement.</p>
<p>If the called function is executing Qt Script code, you can
obtain the script location with the functions <a href="qscriptcontextinfo.html#fileName">fileName</a>() and <a href="qscriptcontextinfo.html#lineNumber">lineNumber</a>().</p>
<p>You can obtain the starting line number and ending line number
of a Qt Script function definition with <a href="qscriptcontextinfo.html#functionStartLineNumber">functionStartLineNumber</a>()
and <a href="qscriptcontextinfo.html#functionEndLineNumber">functionEndLineNumber</a>(),
respectively.</p>
<p>For Qt Script functions and Qt methods (e.g. slots), you can
call <a href="qscriptcontextinfo.html#functionParameterNames">functionParameterNames</a>()
to get the names of the formal parameters of the function.</p>
<p>For Qt methods and Qt property accessors, you can obtain the
index of the underlying <a href="qmetamethod.html">QMetaMethod</a>
or <a href="qmetaproperty.html">QMetaProperty</a> by calling
<a href="qscriptcontextinfo.html#functionMetaIndex">functionMetaIndex</a>().</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="FunctionType-enum" />QScriptContextInfo.FunctionType</h3><p>This enum specifies the type of function being called.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign">
<tt>QScriptContextInfo.ScriptFunction</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The function is a Qt Script function, i.e. it
was defined through a call to <a href="qscriptengine.html#evaluate">QScriptEngine.evaluate</a>().</td>
</tr>
<tr>
<td class="topAlign"><tt>QScriptContextInfo.QtFunction</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The function is a Qt function (a signal, slot
or method).</td>
</tr>
<tr>
<td class="topAlign">
<tt>QScriptContextInfo.QtPropertyFunction</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The function is a Qt property getter or
setter.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QScriptContextInfo.NativeFunction</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">The function is a built-in Qt Script function,
or it was defined through a call to <a href="qscriptengine.html#newFunction">QScriptEngine.newFunction</a>().</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QScriptContextInfo" />QScriptContextInfo.__init__ (<i>self</i>, <a href="qscriptcontext.html">QScriptContext</a>&#160;<i>context</i>)</h3><p>Constructs a new <a href="qscriptcontextinfo.html">QScriptContextInfo</a> from the given
<i>context</i>.</p>
<p>The relevant information is extracted from the <i>context</i> at
construction time; i.e. if you continue script execution in the
<i>context</i>, the new state of the context will not be reflected
in a previously created <a href="qscriptcontextinfo.html">QScriptContextInfo</a>.</p>


<h3 class="fn"><a name="QScriptContextInfo-2" />QScriptContextInfo.__init__ (<i>self</i>, <a href="qscriptcontextinfo.html">QScriptContextInfo</a>&#160;<i>other</i>)</h3><p>Constructs a new <a href="qscriptcontextinfo.html">QScriptContextInfo</a> from the
<i>other</i> info.</p>


<h3 class="fn"><a name="QScriptContextInfo-3" />QScriptContextInfo.__init__ (<i>self</i>)</h3><p>Constructs a null <a href="qscriptcontextinfo.html">QScriptContextInfo</a>.</p>
<p><b>See also</b> <a href="qscriptcontextinfo.html#isNull">isNull</a>().</p>


<h3 class="fn"><a name="columnNumber" />int QScriptContextInfo.columnNumber (<i>self</i>)</h3><h3 class="fn"><a name="fileName" />QString QScriptContextInfo.fileName (<i>self</i>)</h3><p>Returns the name of the file where the code being executed was
defined, if available; otherwise returns an empty string.</p>
<p>For Qt Script code, this function returns the fileName argument
that was passed to <a href="qscriptengine.html#evaluate">QScriptEngine.evaluate</a>().</p>
<p><b>See also</b> <a href="qscriptcontextinfo.html#lineNumber">lineNumber</a>() and <a href="qscriptcontextinfo.html#functionName">functionName</a>().</p>


<h3 class="fn"><a name="functionEndLineNumber" />int QScriptContextInfo.functionEndLineNumber (<i>self</i>)</h3><p>Returns the line number where the definition of the called
function ends, or -1 if the line number is not available.</p>
<p>The ending line number is only available if the <a href="qscriptcontextinfo.html#functionType">functionType</a>() is
<a href="qscriptcontextinfo.html#FunctionType-enum">ScriptFunction</a>.</p>
<p><b>See also</b> <a href="qscriptcontextinfo.html#functionStartLineNumber">functionStartLineNumber</a>().</p>


<h3 class="fn"><a name="functionMetaIndex" />int QScriptContextInfo.functionMetaIndex (<i>self</i>)</h3><p>Returns the meta index of the called function, or -1 if the meta
index is not available.</p>
<p>The meta index is only available if the <a href="qscriptcontextinfo.html#functionType">functionType</a>() is
<a href="qscriptcontextinfo.html#FunctionType-enum">QtFunction</a>
or <a href="qscriptcontextinfo.html#FunctionType-enum">QtPropertyFunction</a>.
For <a href="qscriptcontextinfo.html#FunctionType-enum">QtFunction</a>, the
meta index can be passed to <a href="qmetaobject.html#method">QMetaObject.method</a>() to obtain the
corresponding method definition; for <a href="qscriptcontextinfo.html#FunctionType-enum">QtPropertyFunction</a>,
the meta index can be passed to <a href="qmetaobject.html#property">QMetaObject.property</a>() to obtain
the corresponding property definition.</p>
<p><b>See also</b> <a href="qscriptcontext.html#thisObject">QScriptContext.thisObject</a>().</p>


<h3 class="fn"><a name="functionName" />QString QScriptContextInfo.functionName (<i>self</i>)</h3><p>Returns the name of the called function, or an empty string if
the name is not available.</p>
<p>For script functions of type <a href="qscriptcontextinfo.html#FunctionType-enum">QtPropertyFunction</a>,
this function always returns the name of the property; you can use
<a href="qscriptcontext.html#argumentCount">QScriptContext.argumentCount</a>()
to differentiate between reads and writes.</p>
<p><b>See also</b> <a href="qscriptcontextinfo.html#fileName">fileName</a>() and <a href="qscriptcontextinfo.html#functionType">functionType</a>().</p>


<h3 class="fn"><a name="functionParameterNames" />QStringList QScriptContextInfo.functionParameterNames (<i>self</i>)</h3><p>Returns the names of the formal parameters of the called
function, or an empty <a href="qstringlist.html">QStringList</a> if
the parameter names are not available.</p>
<p><b>See also</b> <a href="qscriptcontext.html#argument">QScriptContext.argument</a>().</p>


<h3 class="fn"><a name="functionStartLineNumber" />int QScriptContextInfo.functionStartLineNumber (<i>self</i>)</h3><p>Returns the line number where the definition of the called
function starts, or -1 if the line number is not available.</p>
<p>The starting line number is only available if the <a href="qscriptcontextinfo.html#functionType">functionType</a>() is
<a href="qscriptcontextinfo.html#FunctionType-enum">ScriptFunction</a>.</p>
<p><b>See also</b> <a href="qscriptcontextinfo.html#functionEndLineNumber">functionEndLineNumber</a>()
and <a href="qscriptcontextinfo.html#fileName">fileName</a>().</p>


<h3 class="fn"><a name="functionType" /><a href="qscriptcontextinfo.html#FunctionType-enum">FunctionType</a> QScriptContextInfo.functionType (<i>self</i>)</h3><p>Returns the type of the called function.</p>
<p><b>See also</b> <a href="qscriptcontextinfo.html#functionName">functionName</a>() and
<a href="qscriptcontext.html#callee">QScriptContext.callee</a>().</p>


<h3 class="fn"><a name="isNull" />bool QScriptContextInfo.isNull (<i>self</i>)</h3><p>Returns true if this <a href="qscriptcontextinfo.html">QScriptContextInfo</a> is null, i.e. does
not contain any information.</p>


<h3 class="fn"><a name="lineNumber" />int QScriptContextInfo.lineNumber (<i>self</i>)</h3><p>Returns the line number corresponding to the statement being
executed, or -1 if the line number is not available.</p>
<p>The line number is only available if Qt Script code is being
executed.</p>
<p><b>See also</b> <a class="compat" href="qscriptcontextinfo-qt3.html#columnNumber">columnNumber</a>() and <a href="qscriptcontextinfo.html#fileName">fileName</a>().</p>


<h3 class="fn"><a name="scriptId" />int QScriptContextInfo.scriptId (<i>self</i>)</h3><p>Returns the ID of the script where the code being executed was
defined, or -1 if the ID is not available (i.e. a native function
is being executed).</p>
<p><b>See also</b> <a href="qscriptengineagent.html#scriptLoad">QScriptEngineAgent.scriptLoad</a>().</p>


<h3 class="fn"><a name="__eq__" />bool QScriptContextInfo.__eq__ (<i>self</i>, <a href="qscriptcontextinfo.html">QScriptContextInfo</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__ne__" />bool QScriptContextInfo.__ne__ (<i>self</i>, <a href="qscriptcontextinfo.html">QScriptContextInfo</a>&#160;<i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>